package com.hdl.servlet.user;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hdl.entity.HdlUser;
import com.hdl.service.UserService;
import com.hdl.service.impl.UserServiceImpl;

@WebServlet("/userpasswordupdate.let")
public class UpdateUserPasswordServlet extends HttpServlet{
	private UserService us = new UserServiceImpl();
  @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	        
	  String id = req.getParameter("id");
	  String psd = req.getParameter("password");
	  us.UpdatePsd(id, psd);
	  HdlUser user = new HdlUser();
	  user = us.selectById(id);
		
		//重新将用户数据存入session中
	 req.getSession().setAttribute("user", user);
	  
}
  @Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doGet(req, resp);
	}
}
